<template>
    <div class="change">
      <div class="text">
          <div style="margin-left:10px">修改</div>
          <div class="edit">
              <div  @click="router.go(-1)">返回</div>
              <div  @click="save">保存</div>
          </div>
      </div>
      <div class="form">
          <div>
              报销人：&nbsp;&nbsp;&nbsp;<input type="text" v-model="name">
          </div>
          <div>
              报销类型：<select name="" id="">
                  <option value="">打车</option>
                  <option value="">餐费</option>
                  <option value="">其他费用</option>
              </select>
          </div>
          <div>
              报销时间：<input type="text"  v-model="date" >
          </div>
          <div>
              报销金额：<input type="text"  v-model="money">
          </div>
          <div>
              报销说明：<input type="text" v-model="stus">
          </div>
      </div>
    </div>
  
  </template>
  
  <script setup>
  import axios from 'axios';
  import { reactive, ref } from 'vue'
  import { onMounted } from 'vue';
  import { useRouter, useRoute } from 'vue-router'
  var router = useRouter()
  var route = useRoute()
  var a=ref([])
  var name = ref("")
  var date = ref(0)
  var money = ref(0)
  var stus = ref("")
  
  a.value= JSON.parse(route.params.row)
  name.value = a.value.name
  date.value=a.value.date
  money.value=a.value.money
  stus.value = a.value.stus
  var id = a.value.id
  var type=a.value.type
  console.log(a.value);
  
  //修改
  var save = () => {
    axios.post("/api/user_money/change", { name: name.value, date: date.value, money: money.value, stus: stus.value ,id:id,type:type}).then((res) => {
        alert("保存成功！")
    })
  }
  
  
  
  
  
  </script>
  
  <style scoped lang="scss">
  .change{
      border: 1px solid #e4e4e4;
  }
  
  .text{
      display: flex;
      width: 1328px;
      justify-content: space-between;
      background: #f2f2f2;
      height: 50px;
      align-items: center;
      color: #000;
      // margin-left: -5px;
      margin-bottom: 20px;
     
  
  }
  .edit{
      display: flex;
      justify-content: space-between;
      width: 150px;
      margin-left: 50px;
      font-size: 14px;
      div{
          width: 100px;
          height: 40px;
          line-height: 40px;
          text-align: center;
          color: #63c8e0;
          font-size: 12px;
          background: white;
          margin-right: 20px;
          cursor: pointer;
      }    
  }
  
  .form div{
      margin-bottom: 20px;
      margin-left: 20px;
      input{
          width: 120px;
          height: 40px;
      }
  }
  
  </style>